home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / var / lib / dpkg / info / screen.preinst < prev    next >
Encoding:
Text File  |  2007-03-08  |  1.3 KB  |  59 lines

  1. #!/bin/sh
  2. #
  3. # $Id: preinst,v 1.15 2002/04/11 02:01:21 laz Exp $
  4. #
  5.  
  6. set -e
  7. [ -n "$DEBUG" ] && set -vx
  8.  
  9. action=$1
  10. version=$2
  11.  
  12. # gimme da debconf
  13. set +vx
  14. . /usr/share/debconf/confmodule
  15. [ -n "$DEBUG" ] && set -vx
  16.  
  17. if [ "$action" = "upgrade" ] ; then
  18.     # use procps' pgrep if possible
  19.     if which pgrep > /dev/null ; then
  20.         PGREP="pgrep -x "
  21.     else
  22.         # if not, manufacture our own pgrep using awk and ps... sucko
  23.         PGREP=screenmaint_pgrep
  24.  
  25.         screenmaint_pgrep() {
  26.             ps auxww | awk "{
  27.                 if (match(\$11,\"screen\")!=0 || match(\$11,\"SCREEN\")!=0) {
  28.                     print \$2;
  29.                 }
  30.             }"
  31.         }
  32.  
  33.     fi
  34.  
  35.     if dpkg --compare-versions "$version" lt "3.9.5-5" ; then
  36.         if [ ! -z "$($PGREP screen)" ] ; then
  37.             # if they're running an old version and there are screen processes
  38.             # running, then prompt
  39.  
  40.             # reset these no matter what
  41.             db_reset screen/old_upgrade_prompt || true
  42.             db_fset screen/old_upgrade_prompt seen false || true
  43.  
  44.             # then prompt
  45.             db_input high screen/old_upgrade_prompt || true
  46.             db_go || true
  47.  
  48.             # and find out what they said
  49.             db_get screen/old_upgrade_prompt || true
  50.             if [ "$RET" = "false" ]; then
  51.                 exit 1
  52.             fi
  53.         fi
  54.     fi
  55. fi
  56.  
  57.  
  58.  
  59.